<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="head" ContentPlaceHolderID="head" runat="server">
    <asp:PlaceHolder runat="server" id="mainScripts">

        <script src="<%=Url.Content("~/scripts/jquery-1.2.6.js") %>" type="text/javascript"></script>

        <script src="<%=Url.Content("~/scripts/jquery.validate-1.5.1.js") %>" type="text/javascript"></script>

        <script src="<%=Url.Content("~/scripts/jquery.validate.extensions.js") %>" type="text/javascript"></script>

        <!-- Manual (advanced mode) setup of jquery validate -->

        <script type="text/javascript">
            $(document).ready(function() {

                $("#advancedForm").validate({
                    errorContainer: $('validation-summary-message'),
                    errorClass: 'input-validation-error'
                });
            });
              
        </script>

        <%=ClientValidation.GenerateScripts("advancedForm", typeof(QSAspMvc.Models.Product), true)%>
    </asp:PlaceHolder>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Create Product (Advanced Client Side Validation)
    </h2>
    <%=Html.CustomValidationSummary() %>
    <% Html.BeginForm("CreateAdvanced", "Product", FormMethod.Post, new { id = "advancedForm" });%>
    <fieldset>
        <legend>Advanced Client Validated Form</legend>
        <p>
            This form's client rules were generated by the framework's JQueryGenerator. Unlike
            the 'simple' client example, the generator was told not to setup the JQuery.Validate
            plugin. You must set it up in the view - giving you control over the plugin's settings
            and allowing you to add aditional client rules/code by hand in advanced scenarios.
        </p>
        <table>
            <tr>
                <td>
                    Product Name:
                </td>
                <td>
                    <%=Html.TextBox("ProductName")%>
                    <%=Html.ValidationMessage("ProductName", "*")%>
                </td>
            </tr>
            <tr>
                <td>
                    Unit Price:
                </td>
                <td>
                    <%=Html.TextBox("UnitPrice")%>
                    <%=Html.ValidationMessage("UnitPrice", "*")%>
                </td>
            </tr>
            <tr>
                <td>
                    Reorder Order:
                </td>
                <td>
                    <%=Html.TextBox("ReorderLevel")%>
                    <%=Html.ValidationMessage("ReorderLevel", "*")%>
                </td>
            </tr>
            <tr>
                <td>
                    Discontinued:
                </td>
                <td>
                    <%=Html.CheckBox("Discontinued")%>
                    <%=Html.ValidationMessage("Discontinued", "*")%>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <span class="message">
                        <%=ViewData["Message"] %>
                    </span>
                    <%=Html.CustomValidationSummary() %>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <input type="submit" value="Save" />
                </td>
            </tr>
        </table>
    </fieldset>
    <% Html.EndForm(); %>
</asp:Content>
